<template>
  <el-row :gutter="30" class="panel-group"style="background: #f1f3ee">
    <div>
      <el-row>
        <el-button style="margin-left: 95%;margin-top: 15px" icon="el-icon-refresh" @click="progress()" circle></el-button>
      </el-row>
    </div>
    <el-col :xs="30" :sm="30" :lg="30" class="card-panel-col">
      <div style="text-align: center" >
        <h1 style="color: red;font-size: 30px">未完成</h1>
      </div>
      <div>
        <el-table
          :data="notCompletedList"
          height="250"
          border
          style="width: 95%;margin: auto">
          <el-table-column label="创建时间" align="center" prop="createTime" style="width: 180px"/>
          <el-table-column label="项目名称" align="center" prop="projectManageName" style="width: 180px"/>
          <el-table-column label="项目负责人" align="center" prop="createName" style="width: 180px"/>
          <el-table-column label="项目接收人" align="center" prop="userName" style="width: 180px"/>
          <el-table-column label="状态" align="center" prop="state" style="width: 180px">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.project_state" :value="scope.row.state"/>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-col>
    <el-col :xs="30" :sm="30" :lg="30" class="card-panel-col">
      <div style="text-align: center" >
        <h1 style="color: #fcc404;font-size: 30px">进行中</h1>
      </div>
      <div>
        <el-table
          :data="inProgressList"
          height="250"
          border
          style="width: 95%;margin: auto">
          <el-table-column label="创建时间" align="center" prop="createTime" style="width: 180px"/>
          <el-table-column label="项目名称" align="center" prop="projectManageName" style="width: 180px"/>
          <el-table-column label="项目负责人" align="center" prop="createName" style="width: 180px"/>
          <el-table-column label="项目接收人" align="center" prop="userName" style="width: 180px"/>
          <el-table-column label="状态" align="center" prop="state" style="width: 180px">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.project_state" :value="scope.row.state"/>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-col>
    <el-col :xs="30" :sm="30" :lg="30" class="card-panel-col">
      <div style="text-align: center" >
        <h1 style="color: #20e35a;font-size: 30px">已完成</h1>
      </div>
      <div>
        <el-table
          :data="completedList"
          height="250"
          border
          style="width: 95%;margin: auto">
          <el-table-column label="创建时间" align="center" prop="createTime" style="width: 180px"/>
          <el-table-column label="项目名称" align="center" prop="projectManageName" style="width: 180px"/>
          <el-table-column label="项目负责人" align="center" prop="createName" style="width: 180px"/>
          <el-table-column label="项目接收人" align="center" prop="userName" style="width: 180px"/>
          <el-table-column label="状态" align="center" prop="state" style="width: 180px">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.project_state" :value="scope.row.state"/>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-col>
  </el-row>
</template>
<script>

import {progress} from "@/api/system/detail";


export default {
  name: 'Index',
  dicts: ['project_state'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 未完成
      notCompletedList: [],
      // 进行中
      inProgressList: [],
      // 已完成
      completedList: [],
    }
  },
  methods: {
    /** 查询列表 */
    progress() {
      this.loading = true;
      progress().then(response => {
        if (response.code === 200) {
          this.notCompletedList = response.data.notCompletedList;
          this.inProgressList = response.data.inProgressList;
          this.completedList = response.data.completedList;
        }
      }).finally(
        () => {
          this.loading = false;
        }
      );
    },
  },
  created() {
    this.progress();
  },
}
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }

      .icon-shopping {
        background: #34bfa3
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
